package org.kpy;

import com.alibaba.fastjson.JSONObject;

import java.io.*;
import java.net.ServerSocket;
import java.net.Socket;

public class Server {
    public static void main(String[] args) throws IOException {
        ServerSocket serverSocket=new ServerSocket(6666);
        Socket socket=serverSocket.accept();
        System.out.println("接收数据");
        InputStream is=socket.getInputStream();
        byte[] bytes =new byte[1024];
        int length=0;
        while((length=is.read(bytes))!=-1) {
            String str = new String(bytes,0, length,"UTF-8");
            System.out.print(str);
        }
    }
}
